//
//  RootViewController.m
//  UI21_扩展
//
//  Created by dllo on 15/12/8.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "RootViewController.h"
#import "SecondViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(50, 250, 50, 50);
    [button setTitle:@"点我" forState:UIControlStateNormal];
    button.backgroundColor = [UIColor blueColor];
    [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    
    
}

- (void)buttonAction
{
    SecondViewController *secondVC = [[SecondViewController alloc] init];
    
    // 创建动画效果
    CATransition *trans = [CATransition animation];
    trans.type = @"pageCurl";
    trans.subtype = kCATransitionFromRight;
    trans.duration = 2.f;
    // 注意动画添加位置
    [self.navigationController.view.layer addAnimation:trans forKey:@"aa"];
    
    [self.navigationController pushViewController:secondVC animated:YES];
    [secondVC release];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
